package org.example.service.impl;

import org.example.domain.entity.Advertising;
import org.example.domain.model.Result;
import org.example.mapper.AdvertisingMapper;
import org.example.service.IAdvertisingsService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdvertisingsServiceImpl implements IAdvertisingsService {

    private AdvertisingMapper advertisingMapper;

    public AdvertisingsServiceImpl(AdvertisingMapper advertisingMapper) {
        this.advertisingMapper = advertisingMapper;
    }

    @Override
    public Result selectAdvertisings() {
        List<Advertising> advertisings = advertisingMapper.selectAdvertising();
        return Result.buildSuccess(advertisings);
    }

    @Override
    public Result showAdvertisings(Integer id) {
        return Result.buildSuccess(advertisingMapper.showAdvertising(id));
    }

    @Override
    public Result hiddenAdvertising(Integer id) {
        return Result.buildSuccess(advertisingMapper.hiddenAdvertising(id));
    }

    @Override
    public Result deleteAdvertising(Integer id) {
        return Result.buildSuccess(advertisingMapper.deleteAdvertising(id));
    }
}
